<{include file="../common/header.tpl"}>
<table width="100%" border="0" cellspacing="0">
 <tr>
    <td width="13%" valign="top">
            <{include file="../common/left.tpl"}>
    </td>
    <td width="87%" valign="top">
        
        <table width="100%" border="0" cellspacing="0">
                <tr>
                <td>
                    <div class="subnav">
                    <div class="content-menu ib-a blue line-x"> 
                    <form name="form1" method="get" action="/webadmin/network/list">
                    <div class="explain-col">
                        所属银行：<select name="bank_id">
                                    <option value="0">所有</option>
                                    <{foreach $banklist as $key => $val}>
                                      <option value="<{$key}>" <{if $bank_id==$key}>selected="selected"<{/if}>><{$val}></option>
                                    <{/foreach}>
                                </select>
								网点级别：<select name="level">
								<option value="0">所有</option>
								<{foreach $level as $key => $val}>
								<option value="<{$key}>" <{if $select_level==$key}>selected="selected"<{/if}>><{$val.desc}></option>
								<{/foreach}>
								</select>
              网点编号：<input type="text" name="network_num" class="input-text" value="<{$network_num}>">
              网点名称：<input type="text" name="network_name" class="input-text" value="<{$network_name}>">
                        <input type="submit" name="dosubmit" class="button" value="搜索"> 
                        <div class="right">
                        <a href="/webadmin/network/import"><em>网点信息导入</em></a><span>|</span>
                        <a href="javascript:void(0);" onclick="export1();"><em>网点信息导出</em></a>
                        </div>
                    </div>
                        
                          <div class="left pr40">
                          <a class="on" href="javascript:;"><em>网点信息管理</em></a><span>|</span>
                          <a href="/webadmin/network/add"><em>添加网点</em></a><span>|</span>
                          </div>
               

                          </form>
                     <div class="clearbox"></div>
                    </div>
                  </div>
              <div class="pad_10">
                <div class="table-list">
                <table width="100%">
                      <thead>
                        <tr>
                            <th width="10%">网点编号</th>
                            <th width="15%" >网点名称</th>
                            <th width="20%">所属银行</th>
                            <th width="10%">登陆帐号</th>
                            <th width="10%">登陆密码</th>
                            <th width="10%">报备</th>
                            <th width="25%">管理操作</th>
                        </tr>
                      </thead>
                      <tbody>
                        <{foreach $list as $key => $val}> 
                        <tr id="network_<{$val.network_id}>">
                            <td align="center"><{$val.network_num}></td>
                            <td align="center" align="left"><{$val.network_name}></td>
                            <td align="center"><{$banklist[$val.bank_id]}></td>
                            <td align="center"><{$val.network_username}></td>
                            <td align="center"><{$val.network_pwd}></td>
                            <td align="center">

                                    <{if $val.open_report>=1}>
                                    <a href="javascript:;" id="report_<{$val.network_id}>" style="color:red;" onclick="open_report(<{$val.network_id}>, 0,<{$val.up_network_id}>)">已开通</a>
                                    <{else}>
                                    <a href="javascript:;" id="report_<{$val.network_id}>" style="color:blue;" onclick="open_report(<{$val.network_id}>, 1,<{$val.up_network_id}>)">未开通</a>
                                    <{/if}>
   
                            </td>
                            <td align="center">
                                <{if $val.level!=4}><a href="/webadmin/network/add?up_network_id=<{$val.network_id}>">添加下级</a> | <{/if}>
                                <a href="javascript:;" onclick="add_attach(<{$val.network_id}>);">添加附件</a> | 
                            <a href="/webadmin/network/edit?network_id=<{$val.network_id}>">修改</a> | 
                            <a name="delete" href="javascript:void(0);" rel="<{$val.network_id}>">删除</a>
                            </td>
                        </tr>       
                        <{/foreach}>
                         
                      </tbody>
                </table>
                        <div style="float:right;"><{$page}></div>
                </div>
              </div>
            </td>
		  </tr>
		</table>
    </td>
 </tr>
</table>
<script type="text/javascript">
$(document).ready(function($) {
	$('a[name="delete"]').click(function() {
		var id = $(this).attr('rel');
		if (id == ''){
			return false;
		}
		$or = confirm('你确定要删除吗？');
		if($or){
	  		$.ajax({
	 			 type:'post',
	 			 async : true,
				 dataType:"json",
				 data: {'network_id':id},
	 			 url:'/webadmin/network/delete',
	 			 success:function(data){
	 				alert(data.note);
	 				if(!data.status){
						return false ;
					}else{
						$('#network_'+id).remove();
					}
	 			 }
	 		});
	  	}
	});
	
});
//导出网点excel
function export1(){
    $.layer({
        type: 2, 
        title: '网点信息导出',
        border:[10, 0.3, '#000'],
        closeBtn:[0, true],
        shade: [0.5, '#000'],
        offset: ['100px', ''],
        area: ['300px', '200px'],
        iframe: {src: '/webadmin/network/export'}
     });
}
function add_attach(network_id){
    $.layer({
        type: 2, 
        title: '网点附件上传',
        border:[10, 0.3, '#000'],
        closeBtn:[0, true],
        shade: [0.5, '#000'],
        offset: ['100px', ''],
        area: ['700px', '500px'],
        iframe: {src: '/webadmin/network/Attach?network_id='+network_id}
     });
}
//开通网点报备
function open_report(network_id, report,up_network_id){
    $.getJSON('/webadmin/network/Report',{network_id:network_id,report:report,up_network_id:up_network_id},function(res){
        alert(res.note);
        if (res.status==1) {
            //if (report ==1) {
                //$('#report_'+network_id).html('<font style="color:red;">已开通</font>');
            //} else {
                //$('#report_'+network_id).html('<font style="color:blue;"未开通</font>');
            //}
            window.location.reload();
        }
        
    });
}
</script>
<{include file="../common/footer.tpl"}>